package mm.test;

import javax.servlet.Servlet;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspEngineInfo;
import javax.servlet.jsp.JspFactory;
import javax.servlet.jsp.PageContext;

public class MockJspFactory extends JspFactory {
	
	public PageContext getPageContext(Servlet servlet,
			ServletRequest servletRequest, ServletResponse servletResponse,
			String string, boolean b, int i, boolean b1) {
		MockPageContext context = new MockPageContext();
		try {
			context.initialize(servlet, 
					(HttpServletRequest) servletRequest, 
					(HttpServletResponse) servletResponse, 
					null, 
					true, 
					1024, 
					true);
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException();
		}
		return context;
	}

	public void releasePageContext(PageContext pageContext) {
	}

	public JspEngineInfo getEngineInfo() {
		return null;
	}
}
